add_rules("mode.release","mode.debug")
if is_mode("debug")then 
    add_defines("OIPRINT")
end 
set_warnings("all")
set_languages("c++20")

target("st_raw")
    set_kind("binary")
    add_files("day5/RMQ/st_raw.cpp")
    set_rundir("./day5/RMQ")

target("st_done")
    set_kind("binary")
    add_files("./day5/RMQ/st_done.cpp")

target("test")
    set_kind("binary")
    add_files("./test.cpp")
    add_tests("1",{files="./test.cpp",defines="OITEST",run_timeout=1000})

target("P3865")
    set_kind("binary")
    add_files("./day6/P3865/*.cpp")

target("binExp")
    set_kind("binary")
    add_files("./day6/binaryExponentiation/*.cpp")
    add_tests("binExp",{files="./day6/binaryExponentiation/*.cpp",defines = "ISTEST"})

target("fperfect")
    set_kind("binary")
    add_files("./day5/perfect/fix.cpp")
    set_rundir("./day5/perfect/")
    for val=1,4 do
        local s = tostring(val)
        add_tests(s,{files="./day5/perfect/fix.cpp",defines="OITEST",runargs={"perfect"..s..".in","perfect"..s..".ans"},run_timeout=1000})
    end 

target("pre88")
    set_kind("binary")
    add_files("./day6/pre88/*.cpp")

target("inverse")
    set_kind("binary")
    add_files("./day7/inverse/*.cpp")
    set_rundir("./day7/inverse")
    for v=1,2 do 
        local strname = tostring(v)
        add_tests(strname,{files="./day7/inverse/*.cpp",defines="OITEST",runargs=strname,run_timeout=1000})
    end

target("P5431")
    set_rundir("./day7/P5431")
    add_files("./day7/P5431/*.cpp")
    for v=1,1 do 
        local s=tostring(v)
        add_tests(s,{files="./day7/P5431/*.cpp",defines="OITEST",runargs={s..".in",s..".out"},run_timeout=1000})
    end 

target("segtree")
    set_rundir("./day7/SegmentTree")
    add_files("./day7/SegmentTree/*.cpp")
    for v=1,2 do 
        local s=tostring(v)
        add_tests(s,{files="./day7/SegmentTree/*.cpp",runargs={s..".in",s..".out"},defines="OITEST",run_timeout=1000})
    end 

target("P3372")
    set_rundir("./day7/P3372")
    add_files("./day7/P3372/*.cpp")
    for v=1,1 do
        local s=tostring(v)
        add_tests(s,{files="./day7/P3372/*.cpp",runargs={s..".in",s..".ans"},defines="OITEST",run_timeout=1000})
    end
    
target("T493931")
    set_rundir("./day8/T493931")
    add_files("./day8/T493931/*.cpp")
    for v=1,2 do 
        local s = tostring(v)
        add_tests(s,{files="./day8/T493931/*.cpp",runargs={s..".in",s..".ans"},defines="OITEST",run_timeout=1000})
    end 

target("U279656")
    set_rundir("./day8/U279656")
    add_files("./day8/U279656/*.cpp")
    for v=1,3 do
        local s=tostring(v)
        add_tests(s,{files="./day8/U279656/*.cpp",runargs={"seg"..s..".in","seg"..s..".ans"},defines="OITEST",run_timeout=1000})
    end

target("P2580")
    set_rundir("./day9/P2580")
    add_files("./day9/P2580/*.cpp")
    for v=1,2 do
        local s=tostring(v)
        add_tests(s,{files="./day9/P2580/*.cpp",runargs={"P2580_"..s..".in","P2580_"..s..".out"},defines="OITEST",run_timeout=1000})
    end 

target("U88589")
    set_rundir("./day10/U88589")
    add_files("./day10/U88589/*.cpp")
    -- add_defines("OITEST")
    -- for v=1,2 do 
    --     local s=tostring(v)
    --     add_tests(s,{files="./day10/U88589/*.cpp",runargs={s..".in",s..".ans"},defines="OITEST",run_timeout=1000})
    -- end 

target("U178578")
    set_rundir("./day10/U178578")
    add_files("./day10/U178578/*.cpp")
    -- for v=1,3 do 
    --     local s=tostring(v)
    --     add_tests(s,{files="./day10/U178578/*.cpp",runargs={"bubble"..s..".in","bubble"..s..".ans"},run_timeout=1000,defines="OITEST"})
    -- end 

target("P9127")
    set_rundir("./day9/P9127")
    add_files("./day9/P9127/*.cpp")

target("P3374")
    set_rundir("./day11/P3374")
    add_files("./day11/P3374/*.cpp")

target("P3608")
    set_rundir("./day11/P3608")
    add_files("./day11/P3608/*.cpp")

target("U466180")
    set_rundir("day12/U466180")
    add_files("day12/U466180/*.cpp")
    for v=1,5 do 
        local s=tostring(v)
        add_tests(s,{files="day12/U466180/*.cpp",defines="OITEST",run_timeout=1000,runargs={"ex_divisor"..s..".in","ex_divisor"..s..".ans"}})
    end 

target("U466168")
    set_rundir("day12/U466168")
    add_files("day12/U466168/*.cpp")

target("U466178")
    set_rundir("day12/U466178")
    add_files("day12/U466178/U466178.cpp")
    for v=1,8 do 
        local s = tostring(v)
        add_tests(s,{files="day12/U466178/U466178.cpp",defines="OITEST",run_timeout=1000,runargs={"ex_circle"..s..".in","ex_circle"..s..".ans"}})
    end 

target("P2871")
    set_rundir("day13/P2871")
    add_files("day13/P2871/*.cpp")

target("P1616")
    set_rundir("day13/P1616")
    add_files("day13/P1616/*.cpp")

target("P1833")
    set_rundir("day13/P1833")
    add_files("day13/P1833/*.cpp")

target("P1855")
    set_rundir("day13/P1855")
    add_files("day13/P1855/*.cpp")

target("P1049")
    set_rundir("day13/P1049")
    add_files("day13/P1049/P1049.cpp")

target("P1507")
    set_rundir("day13/P1507")
    add_files("day13/P1507/P1507.cpp")

target("P1156")
    set_rundir("day13/P1156")
    add_files("day13/P1156/P1156.cpp")

target("P5662")
    set_rundir("day13/P5662")
    add_files("day13/P5662/P5662.cpp")

target("P4141")
    set_rundir("day14/P4141")
    add_files("day14/P4141/P4141.cpp")

target("P6567")
    set_rundir("day14/P6567")
    add_files("day14/P6567/P6567.cpp")

target("P1941")
    set_rundir("day14/P1941")
    add_files("day14/P1941/P1941.cpp")

target("P1064")
    set_rundir("day14/P1064")
    add_files("day14/P1064/P1064.cpp")